import { BaseWindow } from "../../../../component/window/BaseWindow";
import { ILayer } from "../../../../mvc/interfaces/ILayer";
import { Language } from "../../../../../extend/language/Language";
import { ObjCreate } from "../../common/ObjCreate";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { PetExploreAreaInfo } from "../../../resource/info/PetExploreAreaInfo";
import { ItemData } from "../../../resource/info/ItemData";
import { ItemsUtil } from "../../shortcuts/item/ItemsUtil";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { GButton } from "../../../../../com/mui/controls/GButton";
//class PetExploreEnableAreaWindow
    
    export  class PetExploreEnableAreaWindow extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            this.setSize(300, 190);
            this.titleHeight = 28;
            this.title = Language.getString(20055);
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(17, 39, 265, 138, this);
            this._costTxt = ObjCreate.createTextField("", 27, 45, 220, 20, this);
            ObjCreate.createTextField(Language.getString(54463), 27, 65, 220, 20, this);
            this._enableTxt = ObjCreate.createTextField("", 100, 65, 220, 20, this);
            ObjCreate.createTextField(Language.getString(54464), 27, 85, 220, 20, this);
            this._occupyTxt = ObjCreate.createTextField("", 100, 85, 220, 20, this);
            ObjCreate.createTextField(Language.getString(54465), 27, 115, 220, 20, this, new GTextFormat(FontUtil.songtiName, 12, 65280));
            this._enableBtn = ObjCreate.createGButton(Language.getString(54466), 110, 140, 70, 26, this);
            this._enableBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onEnableBtnClickHandler);
            return;
        }

        public updateByAreaInfo(arg1: PetExploreAreaInfo, arg2: PetExploreAreaInfo): void
        {
            var loc1=null;
            if (arg1) 
            {
                loc1 = new ItemData(arg1.costItemCode);
                this._costTxt.htmlText = Language.getStringByParam(54467, arg1.costItemAmount, ItemsUtil.getItemName(loc1));
                this._enableTxt.htmlText = "<font color=\'#00ff00\'>" + arg1.name + "</font>";
            }
            if (arg2) 
            {
                this._occupyTxt.htmlText = "<font color=\'#ff0000\'>" + arg2.name + "</font>";
            }
            return;
        }

        /* internal  */onEnableBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.PetExploreOpenArea));
            return;
        }

        /* internal */ /* var */_costTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_enableTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_occupyTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_enableBtn: GButton;
    }
